/**
 * 
 */
package com.hson.demo.base.web.clickstream;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author Hungel zou
 * @time 2014年10月10日 下午6:02:38
 */
public class ClickstreamLoggerFactory {
	private static final Log log = LogFactory.getLog(ClickstreamLoggerFactory.class);  
	  
    /** 
     * Returns a new logging instance. 
     * 
     * @return a new logging instance 
     */  
    public static ClickstreamLogger getLogger() {  
        String loggerClass = ConfigLoader.getInstance().getConfig().getLoggerClass();  
          
        if (loggerClass == null || "".equals(loggerClass)) {  
            return new NullClickstreamLogger();  
        }  
        else {  
            try {  
                return (ClickstreamLogger) Class.forName(loggerClass).newInstance();  
            }  
            catch (Exception e) {  
                log.fatal("Error instantiating specified ClickstreamLogger: " + loggerClass, e);  
                throw new RuntimeException(e.getMessage());  
            }  
        }  
    }  
}
